Maghnia (Arabic: مغنية) (formerly Marnia) is a town in Tlemcen Province, northwestern Algeria, near the border with Morocco. It is known for the Treaty of Lalla Maghnia (18 March 1845) between France (which was occupying Algeria at the time) and Abderrahman, Sultan of Morocco, which established the boundaries between Algeria and Morocco. The National Route 6 connects it to cities such as Fes and Meknes in Morocco the west, eventually leading to Rabat.
It is the second town in Tlemcen Province, after Tlemcen. The current population is over 95,000.
Archeologists have found evidence of prehistoric people in the area, who were displaced by the Phoenicians. The remnants of burned Ancient Roman military posts were discovered by the French army in 1836, when they entered the area; these posts were occupied, according to the inscriptions, by a numerus Syrorum: a unit of Syrian archers. As such, it was the westermost outpost of Mauretania Caesariensis.
Due to its convenient geographical location — within the watershed of Wadi Tafna midway between Fes and Tlemcen, Maghnia later served as a marketplace for regional nomads.
The Berbers named the place Lalla Marnia (Lalla Maghnia), after a local saint buried in the vicinity. Her mausoleum was probably built in the 18th century.
The French built a redoubt there in 1844, and the modern town developed around it. There is a border crossing to Oujda in Morocco which is sometimes open and sometimes not depending on relations between the two countries.